---
title: ApplicationDataAccess
summary: API reference for ApplicationDataAccess.
status: draft
owner: SAIF BOF documentation team
last_reviewed: 2026-08-21
library: SAIF.Application
reference_type: embedded
---

# ApplicationDataAccess

`ApplicationDataAccess` is the data-access-layer bootstrap owned by `AppManagerBase.DataLayer`. It wraps `SAIF.BOF.Framework`'s `clsDataAccess` and holds a named `SortedList(Of String, IDataPortalInfo)` registry, exposing methods to construct and register SQL Server or Oracle data portals so that concrete business/application objects elsewhere in the solution can execute SQL through them. It authors and executes no SQL itself — it is strictly a connection/portal configuration and registration layer.

## Purpose
- Bootstrap a named collection of SQL Server and/or Oracle data portals for a concrete `AppManagerBase` subclass, configuring connection parameters (`DBUser`, `Database`, `Server`, `BatchID`) before construction ([Register a database connection portal](../../operations/register-database-connection-portal.md)).
- Delegate actual portal construction and registration to `SAIF.BOF.Framework` (`clsSQLDataPortal`, `clsMSOracleDataPortal`, `clsDataAccess.AddDataPortal`).
- Provide keyed retrieval of a previously registered portal via the `DPI(inKey)` indexer.

## Context
- Namespace: `SAIF.Application`
- Assembly/package: `SAIF.Application` (embedded library)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `DBUser` | `Public Property DBUser As String` | Connection user name applied to the next portal constructed by `CreateSQLServerPortal`/`CreateOraclePortal`. |
| `Database` | `Public Property Database As String` | Target database name applied to the next constructed portal. |
| `Server` | `Public Property Server As String` | Target server name applied to the next constructed portal. |
| `BatchID` | `Public Property BatchID As String` | When set to a non-empty value, overrides the environment's `ClientID` for batch/service contexts. |
| `DAL` | `Public ReadOnly Property DAL As IDataAccess` | Exposes the underlying framework `clsDataAccess`/`IDataAccess` instance that portals are registered against. |
| `DPI` (indexer) | `Public Property DPI(inKey As String) As IDataPortalInfo` (Friend setter) | Retrieves a previously registered portal by key; the registering key is lower-cased for lookup. |
| `CreateSQLServerPortal` | `Public Function CreateSQLServerPortal(inKey As String) As IDataPortalInfo` | Constructs a `clsSQLDataPortal` from the current connection properties, registers it via `DAL.AddDataPortal`, and stores it keyed by `inKey` ([Register a database connection portal](../../operations/register-database-connection-portal.md)). |
| `CreateOraclePortal` | `Public Function CreateOraclePortal(inKey As String) As IDataPortalInfo` | Constructs a `clsMSOracleDataPortal` from the current connection properties, registers it via `DAL.AddDataPortal`, and stores it keyed by `inKey` ([Register a database connection portal](../../operations/register-database-connection-portal.md)). |
| `New` | `Public Sub New(Optional inBatchUserID As String = "")` | Constructs the registry, optionally seeding a batch user ID used as `BatchID`. |

## Behavioral notes
- `CreateSQLServerPortal`/`CreateOraclePortal` set `DBMSType` to `SqlServer`/`Oracle` respectively on an internal `clsDataAccess.clsEnvironment`, overriding `ClientID` with `BatchID` when a non-empty batch ID has been set.
- The framework's own `AddDataPortal` operation sequence was not resolved via RAG for this run and is not traced further here.**

## Constraints and usage notes
- This class authors no SQL and executes none directly; SQL execution happens through the registered `IDataPortalInfo` instances in consuming business/application objects, outside this library's scope.

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Sources
- `SAIF.Application\ApplicationDataAccess.vb`
